package cn.com.utt.unms.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import cn.com.utt.unms.pojo.WxMarketing;

@Mapper
public interface WxMarketingMapper {

	@Select("select * from wx_marketing where cfg_id=#{cfgId}")
	WxMarketing queryMarketingByCfgId(@Param("cfgId") long cfgId);

	@Update("update `wx_marketing` set keyword=#{keyword},attention_text=#{attentionText},keyword_text=#{keywordText},msg_text=#{msgText} where id=#{id}")
	void update(WxMarketing wxMarketing);
	
	@Insert("insert into `wx_marketing`(keyword,attention_text,keyword_text,msg_text,cfg_id) values(#{keyword},#{attentionText},#{keywordText},#{msgText},#{cfgId})")
	@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
	void save(WxMarketing wxMarketing);

}